// 接口
interface IUserInfo {
    name: string
    age: number
}

const getUserName = (userInfo: IUserInfo = {
    name: '',
    age: 0
}): string => {
    return userInfo.name
};

getUserName({
    name: '',
    age: 0
});

let userInfo = {
    name: '',
    age: 32,
    size: 32
};

// 类型兼容性，只要userInfo能够兼容IUserinfo就可以了
getUserName(userInfo)


// readonly 只读


// 索引类型
interface IArrayIndex {
    0: number
    readonly 1: string
}


const list2: IArrayIndex = [1, 's']


// 函数接口
interface IFunc {
    (num1: number, num2: number): string
}

const myFunc: IFunc = (num1: number, num2: number) => { return ''; }



interface IRoleDic {
    // 表示它的key必须为string，值也必须为string
    [id: string]: string
}

const map: IRoleDic = {
    agc: 'sdf'
}
export {};
